import hyRequest from '../index'

import { IAccount, IDataType, ILoginResult, userInfo } from './type'

enum LoginAPI {
  AccountLogin = 'sys/login',
  LoginUserInfo = 'sys/profile' // 用法: /users/1
  // UserMenus = '/role/' // 用法: role/1/menu
}

export function accountLoginRequest(account: IAccount) {
  return hyRequest.post<IDataType<ILoginResult>>({
    url: LoginAPI.AccountLogin,
    data: account
  })
}

export function requestUserInfoById() {
  return hyRequest.post<IDataType<any>>({
    url: LoginAPI.LoginUserInfo,
    showLoading: false
  })
}

// export function requestUserMenusByRoleId(id: number) {
//   return hyRequest.get<IDataType>({
//     url: LoginAPI.UserMenus + id + '/menu',
//     showLoading: false
//   })
// }
